package com.lightheart.sphr.xiaobinggan.design

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import com.lightheart.sphr.xiaobinggan.R

class WaveViewActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_wave_view)
        val imageView = findViewById<View>(R.id.image) as ImageView
        val waveView3 = findViewById<View>(R.id.wave_view) as WaveView

        val lp = FrameLayout.LayoutParams(-2, -2)
        lp.gravity = Gravity.BOTTOM or Gravity.CENTER
        waveView3.setOnWaveAnimationListener { y ->
            lp.setMargins(0, 0, 0, y.toInt() + 2)
            imageView.layoutParams = lp
        }
    }
}

